perm filename CVT.SAI[PRO,MUS] blob sn#089496 filedate 1974-02-27 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	begin "CVT"
C00006 ENDMK
C⊗;
begin "CVT"
integer i,j,k,cnt,brk;
boolean eof,fail;
string s,line,author_line,title;
string array authors[1:50],Initials[1:50];
integer authornum,Nauthors,Ninitials,initialnum;
define toquote="1",tospace="2",tocomma="3",tolf="4",toperiod="5";
define crlf="'15&'12";

setbreak(toquote,"""","","INS");
setbreak(tospace," ","","INS");
setbreak(tocomma,",","","INS");
setbreak(tolf,'12,'15,"INS");
setbreak(toperiod,".","","INA");

	open(1,"DSK",0,2,0,200,brk,eof);
	lookup(1,"BIBLIO.JAM",fail);
	open(2,"DSK",0,0,2,0,brk,eof);
	enter(2,"BIBLIO.CVT",fail);
	if fail then usererr(0,0,"Can't find BIBLIO.JAM");
	while true do
	begin "LFLOOP"
	    s←input(1,tolf);
	    if eof then done "LFLOOP";
	    if length(s)=0 then continue "LFLOOP";
	    line←s;
	    while true do
	    begin "RL"
		s←input(1,tolf);
		if eof then done "RL";
		if length(s)=0 then done "RL";
		line←line&" "&s;
	    end "RL";
	    Nauthors←0;
	    author_line←scan(line,toquote,brk);
	    while length(author_line)>0 do
		authors[Nauthors←Nauthors+1]←scan(author_line,tocomma,brk);
	    title←scan(line,toquote,brk);
	    line←title&line;
	    author_line←"";
	    for i←1 step 1 until Nauthors do
	    begin "IVAU"
		while length(authors[i])>0 ∧ authors[i][1 for 1]=" " do
		    authors[i]←authors[i][2 to ∞];
		if length(authors[i])=0 then continue "IVAU";
		Ninitials←0;
		do initials[Ninitials←Ninitials+1]←scan(authors[i],toperiod,brk)
		until length(authors[i])=0;
		if i>1 then author_line←author_line&", ";
		author_line←author_line&initials[Ninitials]&", ";
		for j←1 step 1 until Ninitials-1 do
		    author_line←author_line&initials[j];
	    end "IVAU";
	    line←author_line&", "&line;
	    while length(line)>0 ∧ line[1 for 1]=" " do
		line←line[2 to ∞];
	    while length(line)>50 do
	    begin "BRKL"
		for i←50 step 1 until length(line) do
		    if line[i for 1]=" " then done;
		out(2,line[1 to i-1]&crlf);
		line←line[i+1 to ∞];
		while length(line)>0 ∧ line[1 for 1]=" " do
		    line←line[2 to ∞];
	    end "BRKL";
	    out(2,line&crlf&crlf);
	end "LFLOOP";
	close(2);
	close(1);
	release(2);
end;